home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- Caption = "Form1"
- ClientHeight = 3795
- ClientLeft = 945
- ClientTop = 2220
- ClientWidth = 5070
- Height = 4485
- Left = 885
- LinkTopic = "Form1"
- ScaleHeight = 3795
- ScaleWidth = 5070
- Top = 1590
- Width = 5190
- Begin CommonDialog CMDialog1
- Left = 0
- Top = 15
- End
- Begin PictureBox Picture1
- Height = 3780
- Left = -75
- ScaleHeight = 3750
- ScaleWidth = 5145
- TabIndex = 0
- Top = 0
- Width = 5175
- Begin PictureBox Picture2
- AutoSize = -1 'True
- BorderStyle = 0 'None
- Height = 2535
- Left = 810
- Picture = SCROLL.FRX:0000
- ScaleHeight = 2535
- ScaleWidth = 3300
- TabIndex = 3
- Top = 390
- Width = 3300
- End
- Begin HScrollBar HScroll1
- Height = 270
- LargeChange = 200
- Left = 30
- TabIndex = 2
- Top = 3450
- Width = 3495
- End
- Begin VScrollBar VScroll1
- Height = 3510
- LargeChange = 200
- Left = 4845
- TabIndex = 1
- Top = -15
- Width = 270
- End
- End
- Begin Menu mnuFile
- Caption = "&File"
- Begin Menu mnuOpen
- Caption = "&Open Bitmap"
- End
- Begin Menu mnuExit
- Caption = "E&xit"
- End
- End
- Option Explicit
- Sub DisplayScrollBars ()
- Dim x, y, state As Integer
- x = 0
- y = 0
- picture1.Height = form1.ScaleHeight
- picture1.Width = form1.ScaleWidth
- picture2.AutoSize = True
- If picture2.Height < picture1.Height Then
- vscroll1.Visible = False
- Else
- x = 1
- End If
- If picture2.Width < picture1.Width Then
- hscroll1.Visible = False
- Else
- y = 2
- End If
- state = x + y
- Select Case state
- ' both invisible
- Case 0
- picture2.Move 0, 0
- hscroll1.Value = 0
- vscroll1.Value = 0
- ' vscroll only
- Case 1
- vscroll1.Move form1.ScaleWidth - vscroll1.Width, 0
- vscroll1.Height = form1.ScaleHeight
- vscroll1.Visible = True
- hscroll1.Value = 0
- ' hscroll only
- Case 2
- hscroll1.Move 0, form1.ScaleHeight - hscroll1.Height
- hscroll1.Width = form1.ScaleWidth
- hscroll1.Visible = True
- vscroll1.Value = 0
- ' hscroll and vscroll
- Case 3
- vscroll1.Move form1.ScaleWidth - vscroll1.Width, 0
- vscroll1.Height = form1.ScaleHeight - hscroll1.Height
- hscroll1.Move 0, form1.ScaleHeight - hscroll1.Height
- hscroll1.Width = form1.ScaleWidth
- hscroll1.Visible = True
- vscroll1.Visible = True
- picture2.AutoSize = False
- picture2.Height = picture1.Height - picture2.Top - hscroll1.Height
- picture2.Width = picture1.Width - picture2.Left - vscroll1.Width
- End Select
- End Sub
- Sub Form_Load ()
- picture1.Move 0, 0
- picture2.Move 0, 0
- picture1.Height = form1.ScaleHeight
- hscroll1.Max = picture2.Width
- vscroll1.Max = picture2.Height
- End Sub
- Sub Form_Resize ()
- DisplayScrollBars
- End Sub
- Sub HScroll1_Change ()
- picture2.Left = -(hscroll1.Value)
- picture2.Width = picture1.Width - picture2.Left - vscroll1.Width
- End Sub
- Sub mnuExit_Click ()
- End
- End Sub
- Sub mnuOpen_Click ()
- CMDialog1.Filter = "*.BMP (Bitmaps)|*.BMP"
- CMDialog1.FilterIndex = 1
- CMDialog1.Action = 1
- picture2.Picture = LoadPicture(CMDialog1.Filename)
- hscroll1.Max = picture2.Width
- vscroll1.Max = picture2.Height
- DisplayScrollBars
- End Sub
- Sub VScroll1_Change ()
- picture2.Top = -(vscroll1.Value)
- picture2.Height = picture1.Height - picture2.Top - hscroll1.Height
- End Sub
-